package com.shengruan.common;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

public class SetCacheFilter  implements Filter {


	    public void doFilter(ServletRequest request,
	                         ServletResponse response,
	                         FilterChain chain)
	            throws IOException, ServletException 
	    {
	        	HttpServletResponse httpResponse = (HttpServletResponse)response;
	        	httpResponse.setHeader("Pragma", "No-cache");
	        	httpResponse.setHeader("Cache-Control","no-cache");
	        	httpResponse.setDateHeader("Expires", -1);
	           // PrintWriter out = httpResponse.getWriter();
	           // out.println("<script>window.onunload=e;function e(){closes.Click();return;window.close();}</script><OBJECT id=closes type=\"application/x-oleobject\" classid=\"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11\"> <param name=\"Command\" value=\"Close\"> </object>");
	            chain.doFilter(request, response);
	    }
	    public void init(FilterConfig filterConfig) throws ServletException {}
	    public void destroy() {}
}
